

#ifndef __FRAME_PROCESS_H
#define __FRAME_PROCESS_H
#include <pthread.h>
#include <time.h>


#ifdef __cplusplus
extern "C" {
#endif



/***********帧相关*********** */
//定义环形缓冲区最大长度
#define BUFFER_SIZE 10000
//描述帧
typedef struct Frame_DATA{

   unsigned char kernel_add;
   unsigned char fun_code;
   unsigned char start_add;
   unsigned char CRC[2];


   char * name;
   int size;
   int data[32];


    time_t time;

   
    
}Frame_DATA_t, *Frame_DATA_p;



//描述环形缓冲区
struct buffer {
    Frame_DATA_t Frame_DATA[BUFFER_SIZE];
    int read_pos, write_pos, size;
    pthread_mutex_t mutex;
    pthread_cond_t not_empty, not_full;
};
//相关API
void buffer_init(struct buffer *buf);
Frame_DATA_p buffer_get(struct buffer *g_buf);
void buffer_put(struct buffer * g_buf, Frame_DATA_p frame);
void pthread_destroy(struct buffer *g_buf);
void print_student(Frame_DATA_t s) ;


#ifdef __cplusplus
}
#endif


#endif



















